﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;

namespace Datav.Design.Core.Extensions
{
    /// <summary>
    ///
    /// </summary>
    public static class StaticHttpContextExtensions
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseStaticHttpContext(this IApplicationBuilder app)
        {
            var httpContextAccessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
            Core.Utilities.HttpContext.Configure(httpContextAccessor);
            return app;
        }
    }
}